/*
 * Copyright (c) Huawei Technologies Co., Ltd. 2022-2022. All rights reserved.
 *
 */

import path from 'path';

import { BuildDirConst } from '../../const/build-directory-const.js';
import { ProjectModel } from '../../model/project/project-model.js';
import { InjectUtil } from '../../utils/inject-util.js';

export class ProjectPathInfoIml {
  private readonly _projectModel: ProjectModel;
  private readonly _productName: string;
  private readonly _projectPath: string;

  constructor(projectModel: ProjectModel, productName: string) {
    this._projectModel = projectModel;
    this._productName = productName;
    this._projectPath = projectModel.getProjectDir();
  }

  getProjectBuildPath(): string {
    return path.resolve(InjectUtil.getBuildCacheParentDir(this._projectPath, this._projectModel.getProject().getName(), false), BuildDirConst.BUILD_ROOT);
  }

  getProjectOutputPath(): string {
    return path.resolve(this.getProjectBuildPath(), BuildDirConst.BUILD_OUTPUTS, this._productName);
  }
  getProjectDebugSymbolPath(): string {
    return path.resolve(this.getProjectOutputPath(), BuildDirConst.OUTPUT_SYMBOL);
  }
}
